'use strict';

const Controller = require('egg').Controller;

class BannerController extends Controller {
  async save() {
    let {ctx}=this
    let res=await ctx.model.Banner.bulkCreate([
      {
        title:'轻松过四六级',
        cover:'http://127.0.0.1:7001/public/uploads/2021/08/13/1.jpg',
        video_id:'16'
      },
      {
        title:'吉娜首次公开腰围',
        cover:'http://127.0.0.1:7001/public/uploads/2021/08/13/2.jpg',
        video_id:'16'
      },
      {
        title:'30天vlog挑战奖励50万',
        cover:'http://127.0.0.1:7001/public/uploads/2021/08/13/3.jpg',
        video_id:'2'
      }
    ])
    ctx.apiSuccess(res)
  }

  async index(){
    let {ctx}=this
    let res=await ctx.model.Banner.findAll()
    ctx.apiSuccess(res)
  }
}

module.exports = BannerController;
